n, nums, count = int(input()), list(map(int, input().split())), 0

for i, num in enumerate(nums):
    for j, char in enumerate(nums):
        if i < j and num > char:
            count += 1

print(count)
